package com.shycloud.mido.member.api.dto;

import lombok.Data;
import org.apache.commons.lang.StringUtils;

import java.io.Serializable;
import java.math.BigDecimal;

@Data
public class OptHardwareDTO implements Serializable {

	private static final long serialVersionUID = 7768601876133381213L;

	/** 套餐 ID */
	private Integer id;
	/** 项目排序 */
	private Integer sort;
	/** 折后价(单位:元) */
	private BigDecimal salePrice;
	/** 项目类型("销售","租赁") */
	private String itemType;
	/** 运营商分账数额 */
	private String bonus;
	/** 运营商是否可以自定义可见(0: 不可以, 1:可以) */
	private Boolean isCustomizeVisible;
	/** 运营商是否可以自定义名字(0: 不可以, 1:可以) */
	private Boolean isCustomizeName;
	/** vip时长(0:永久) */
	private Integer vipDuration;

	public Integer getVipDuration() {
		if (this.vipDuration != null && this.vipDuration != 0) {
			return this.vipDuration / 30;
		}
		if (this.vipDuration != null && this.vipDuration == 0) {
			return 0;
		}
		return this.vipDuration;
	}

	/** 硬件时长(0:永久) */
	private Integer hardwareDuration;

	public Integer getHardwareDuration() {
		if (this.hardwareDuration == 0) {
			return 0;
		} else {
			return this.hardwareDuration / 30;
		}
	}

	/** 快乐贝数量 */
	private Integer gold;
	/** 套餐名称 */
	private String customName;

	public String getCustomName() {

		if (StringUtils.isEmpty(this.customName)) {
			return this.comboName;
		} else {
			return this.customName;
		}
	}

	/** 套餐名称 */
	private String comboName;
	/** 是否启用 */
	private String isVisible;
	/** 运营商自定义套餐信息ID */
	private Integer hardwareSaleId;
}
